package com.axxy.help;

import com.sun.deploy.util.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author 一缕茜阳
 * @date 2021/8/3
 */
public class Q1 {
    public static void main(String[] args) {
        List<Box> list = new ArrayList<>();
        Box A = new Box("0");
        Box B = new Box("1");
        Box C = new Box("2");
        list.add(A);
        list.add(B);
        list.add(C);
        String value = "";
        String rs = "";
        for (Box box:
             list) {
            if (box.isChecked) {
                    value = value + box.no + ",";
                }
            }
        System.out.println(value);
        for (int i = 0; i < value.length()-1; i++) {
            rs = rs + value.charAt(i);
        }

        System.out.println(rs);
    }

}



class Box {
    boolean isChecked = false;
    String no;

    public Box(String no) {
        this.no = no;
    }

    protected void checked() {
        isChecked = true;
    }

}